﻿using System;
using System.Collections.Generic;
using System.ComponentModel.Composition;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace SAP.BusinessOne.WebBridge
{
    [Export(typeof(IIMCCBridge))]
    class IMCCBridge : IIMCCBridge
    {
        private static readonly log4net.ILog log = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);

        public int Login(string uri, string user, string password)
        {
            int ret = new Random().Next();
            log.InfoFormat("IMCCBridge::Login->{0},{1},{2},{3}", uri, user, password, ret);
            return ret;
        }

        public int DeployPackage(string package)
        {
            int ret = new Random().Next();
            log.InfoFormat("IMCCBridge::DeployPackage->{0},{1}", package, ret);
            return ret;
        }

        public bool IsCompanyEnabled()
        {
            bool ret = (new Random().Next() % 2 == 0 ? true : false);
            log.InfoFormat("IMCCBridge::IsCompanyEnabled->{1}", ret);
            return ret;
        }

        public string GetMessageList(string filter, bool flag, int num, float f, double d, long x)
        {
            string ret = new Random().Next().ToString() + "__ this is string return type";
            log.InfoFormat("IMCCBridge::GetMessageList->{0},{1}", filter, ret);
            return ret;
        }


        public void Test()
        {
            // ...
        }
    }

    interface IIMCCBridge
    {
        int Login(string uri, string user, string password);
        int DeployPackage(string package);
        bool IsCompanyEnabled();
        string GetMessageList(string filter, bool flag, int num, float f, double d, long x);
        void Test();
    }
}
